<?php

namespace addons\Minerva\common\models;

use common\models\base\BaseModel;
use Yii;

/**
 * This is the model class for table "{{%minerva_department}}".
 *
 * @property int $id 主键id
 * @property int $pid 上级部门
 * @property string $title 部门名称
 * @property int $level 级别
 * @property int $sort 排序
 * @property string $tree 树
 * @property int $status -1:已删除,0:禁用,1:正常
 * @property int $created_at 创建时间
 * @property int $updated_at 修改时间
 */
class MinervaDepartment extends BaseModel
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%minerva_department}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['pid', 'level', 'sort', 'status', 'created_at', 'updated_at'], 'integer'],
//            [['title'], 'required'],
            [['title'], 'string', 'max' => 32],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '主键id',
            'pid' => '上级部门',
            'title' => '部门名称',
            'level' => '级别',
            'sort' => '排序',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '修改时间',
        ];
    }
}
